/*************************************************************************
    > File Name: AccountItem.cpp
    > Author: skylon
    > Site: blog.csdn.net/tcm_zhangpeng 
    > Created Time: 2016年05月15日 星期日 14时57分10秒
 ************************************************************************/

#include"AccountItem.h"

AccountItem::AccountItem()
{
	m_Anumber = "";
	m_Password = "";
	m_Name = "";
	m_Balance = 0;
}

AccountItem::AccountItem(string Anumber, string Password, string Name, const double Balance)
{
	m_Anumber = Anumber;
	m_Password = Password;
	m_Name = Name;
	m_Balance = Balance;
}

void AccountItem::Display()
{
	cout << "Account: " << m_Anumber << endl << endl;
	cout << "Password: " << m_Password << endl << endl;
	cout << "Name: " << m_Name << endl << endl;
	cout << "Balance: " << m_Balance << endl << endl << endl << endl;
}

void AccountItem::Read(ifstream &s)
{
	s >> m_Anumber;
	s >> m_Password;
	s >> m_Name;
	s >> m_Balance;
}

void AccountItem::Write(ofstream &s)
{
	s << m_Anumber << endl;
	s << m_Password << endl;
	s << m_Name << endl;
	s << m_Balance << endl << endl;
}

short AccountItem::CheckNumber(string Anumber)
{
	if (m_Anumber == Anumber)
		return 1;
	else
		return 0;
}

string AccountItem::GetNumber()
{
	return m_Anumber;
}

string AccountItem::GetPassword()
{
	return m_Password;
}

void AccountItem::DeductBalance(double pay)
{
	m_Balance -= pay;
}

double AccountItem::GetBalance()
{
	return m_Balance;
}

string AccountItem::GetName()
{
	return m_Name;
}

short AccountItem::IsNull()
{
	if (m_Anumber == "")
		return 1;
	return 0;
}










